#include <stdlib.h>
#include <stdio.h>

#include "opengl_gp_lib.h"

#ifdef OS_WIN
#include <Windows.h>
#endif

#define UNUSE_PARAM(name) (void)name

#ifdef OS_WIN


BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    UNUSE_PARAM(hModule);
    UNUSE_PARAM(lpReserved);
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
        break;
    case DLL_THREAD_ATTACH:
        break;
    case DLL_THREAD_DETACH:
        break;
    case DLL_PROCESS_DETACH:
        glgpReleaseContext();
        break;
    }
    return TRUE;
}

#endif

#ifdef Q_OS_LINUX

//function at dll init
__attribute__ ((constructor)) void dll_init(void)
{
//    printf("%s/n", __func__);
}

//function at dll finish
__attribute__ ((destructor)) void dll_fini(void)
{
//    printf("%s/n", __func__);
    glfwTerminate();
}
#endif

